<?php
/**
 * The Footer widget areas.
*/

$widget_displacement = get_option( 'widget_displacement', '3_widgets' );

	switch($widget_displacement)
	{
		case '1_widget':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_piece">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case '2_widgets':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_half">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_half_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case '3_widgets':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_third">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_third">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget one_third_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case '4_widgets':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_forth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_forth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget one_forth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_4' ) )
			{
				echo '<div class="footer_widget one_forth_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_4' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case '5_widgets':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_fifth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_fifth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget one_fifth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_4' ) )
			{
				echo '<div class="footer_widget one_fifth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_4' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_5' ) )
			{
				echo '<div class="footer_widget one_fifth_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_5' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case '6_widgets':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_4' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_4' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_5' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_5' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_6' ) )
			{
				echo '<div class="footer_widget one_sixth_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_6' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case 'one_half_two_forths':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget" style="width: 465px; margin-right: 30px;">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_forth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget one_forth_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case 'two_forths_one_half':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_forth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_forth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget" style="width: 465px;">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case 'one_half_three_sixths':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget" style="width: 470px; margin-right: 20px;">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_4' ) )
			{
				echo '<div class="footer_widget one_sixth_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_4' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case 'three_sixths_one_half':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_3' ) )
			{
				echo '<div class="footer_widget one_sixth">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_3' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_4' ) )
			{
				echo '<div class="footer_widget" style="width: 470px;">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_4' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case 'one_third_two_thirds':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget one_third">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget two_thirds_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
		break;
		
		case 'two_thirds_one_third':
			if ( is_active_sidebar( 'footer_widget_area_1' ) )
			{
				echo '<div class="footer_widget two_thirds">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_1' );
					echo '</ul>';
				echo '</div>';
			}
			
			if ( is_active_sidebar( 'footer_widget_area_2' ) )
			{
				echo '<div class="footer_widget one_third_last">';
					echo '<ul>';
						dynamic_sidebar( 'footer_widget_area_2' );
					echo '</ul>';
				echo '</div>';
			}
		break;
	} // end switch
?>